package com.tanhua.domain;

import com.tanhua.domain.db.User;

public class UserHolder {

    private  static  ThreadLocal<User> threadLocal=new ThreadLocal<User>();

    //将登录用户放入线程容器中
    public static void saveUser(User user){
        threadLocal.set(user);
    }

    //将登录用户从线程容器中获取
    public static User findUser(){
        return threadLocal.get();
    }

    //将登录用户从线程容器中删除
    public static void removeUser(){
        threadLocal.remove();
    }
}
